﻿/*********************************************************************************
**                                                                              **
**  Copyright (C) 2024 LiLong                                                   **
**  This file is part of RinexFileReader.                                       **
**                                                                              **
**  RinexFileReader is free software: you can redistribute it and/or modify     **
**  it under the terms of the GNU General Public License as published by        **
**  the Free Software Foundation, either version 3 of the License, or           **
**  (at your option) any later version.                                         **
**                                                                              **
**  RinexFileReader is distributed in the hope that it will be useful,          **
**  but WITHOUT ANY WARRANTY; without even the implied warranty of              **
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               **
**  GNU General Public License for more details.                                **
**                                                                              **
**  You should have received a copy of the GNU General Public License           **
**  along with RinexFileReader. If not, see <https://www.gnu.org/licenses/>.    **
**********************************************************************************/
#pragma once

#include "Datadefine.h"
#include "RinexFileReaderGlobal.h"

#include <memory>

namespace Rinex
{
struct ObservationData;
class RINEXFILEREADER_EXPORT ObservationDataFile
{
public:
    ObservationDataFile(ObservationDataFile&& other) noexcept;
    ObservationDataFile(const ObservationDataFile& other);
    ~ObservationDataFile();
    ObservationDataFile& operator=(ObservationDataFile&& other) noexcept;
    ObservationDataFile& operator=(const ObservationDataFile& other);
    // IONEX VERSION / TYPE
    double version() const;
    SatelliteSystem satelliteSystem() const;
    // PGM / RUN BY / DATE
    const std::string& program() const;
    const std::string& agency() const;
    const std::string& createDateTime() const;
    // COMMENT
    const std::vector<std::string>& comments() const;
    // MARKER NAME
    const std::string& markerName() const;
    // MARKER NUMBER
    const std::optional<std::string>& markerNumber() const;
    // MARKER TYPE
    const std::string& markerType() const;
    // OBSERVER / AGENCY
    const std::tuple<std::string, std::string>& observerAgency() const;
    // REC # / TYPE / VERS
    const std::string& recNumber() const;
    const std::string& recType() const;
    const std::string& recVersion() const;
    // ANT # / TYPE
    const std::string& antNumber() const;
    const std::string& antType() const;
    // APPROX POSITION XYZ
    const std::tuple<double, double, double>& approxPositionXYZ() const;
    // ANTENNA: DELTA H/E/N
    const std::tuple<double, double, double>& antennaDeltaHEN() const;
    // ANTENNA: DELTA X/Y/Z
    const std::optional<std::tuple<double, double, double>>& antennaDeltaXYZ() const;
    // ANTENNA: PHASECENTER
    const std::optional<PhaseCenter>& phaseCenter() const;
    // ANTENNA: B.SIGHT XYZ
    const std::optional<std::tuple<double, double, double>>& antennaBSightXYZ() const;
    // ANTENNA: ZERODIR AZI
    const std::optional<double>& antennaZerodirAZI() const;
    // ANTENNA: ZERODIR XYZ
    const std::optional<std::tuple<double, double, double>>& antennaZerodirXYZ() const;
    // CENTER OF MASS: XYZ
    const std::optional<std::tuple<double, double, double>>& centerOfMassXYZ() const;
    // DOI
    const std::optional<std::string>& doi() const;
    // LICENSE OF USE
    const std::optional<std::string>& licenseOfUse() const;
    // STATION INFORMATION
    const std::optional<std::string>& stationInformation() const;
    // SYS / # / OBS TYPES
    const std::vector<SysObsTypes>& sysObsTypes() const;
    // SIGNAL STRENGTH UNIT
    const std::optional<std::string>& signalStrengthUnit() const;
    // INTERVAL
    const std::optional<double>& interval() const;
    // TIME OF FIRST OBS
    const TimeOfObs& timeOfFirstObs() const;
    // TIME OF LAST OBS
    const std::optional<TimeOfObs>& timeOfLastObs() const;
    // GLONASS SLOT / FRQ #
    const std::vector<GLONASSSlotFreq>& glonassSlotFreq() const;
    // LEAP SECONDS
    const std::optional<LeapSeconds>& leapSeconds() const;
    // # OF SATELLITES
    const std::optional<int>& ofSatellites() const;
    // PRN / # OF OBS
    const std::vector<PrnOfObs>& prnOfObs() const;
    ////////////////////////////////////////
    const std::vector<ObsData>& datas() const;

protected:
    ObservationDataFile(std::shared_ptr<ObservationData> d);
    friend class RindexFile;

private:
    struct Impl;
    std::unique_ptr<Impl> m_impl;
};
} // namespace Rinex